<template>
	<view style="background-color: white;padding: 30rpx;">
		<view style="text-align: center;justify-content: center;display: flex;margin-bottom: 16rpx;">
			<image :src="res.cover" mode="" style="width: 750rpx; height: 380rpx;"></image>
		</view>
		<view class="" style="margin-bottom: 16rpx;display: flex;align-items: center;justify-content: space-between;">
			<view class="" style="display: flex;align-items: center;" @click="coll()">
				<image class="icon" :src="res.is_collect==0?notC:isC" mode="aspectFit"></image>
					<view class="">
						点击收藏
					</view>
			</view>
				<!-- <view class="flex-center share-btn" @tap.stop="toAppShare">
					<view class="iconfenxiang iconfont" style="font-size: 42rpx;" :style="{color:primaryColor}"></view>
					<text class="f-icontext c-caption" style="padding-left: 6rpx;">分享</text>
				</view> -->
				<button class="flex-center" open-type="share" style="justify-content: unset;">
					<view class="iconfenxiang iconfont" style="font-size: 42rpx;" :style="{color:primaryColor}">
					</view>
					<text class="f-icontext c-caption" style="padding-left: 6rpx;">分享</text>
				</button>
		</view>
		<view class="" style="margin-bottom: 16rpx;display: flex;align-items: center;justify-content: space-between;">
			<view style="font-size: 30rpx;letter-spacing: 2rpx;display: flex;align-items: center;">
				星级：<i class="iconfont iconyduixingxingshixin icon-font-color"></i>{{res.star}}
			</view>
			<view style="font-size: 30rpx;letter-spacing: 2rpx;">
				已服务：{{res.order_num}}单
			</view>
		</view>
			<view style="font-size: 30rpx;letter-spacing: 2rpx;margin-bottom: 16rpx;">
				营业时间：{{res.start_time}}~{{res.end_time}}
			</view>
			<view style="font-size: 30rpx;letter-spacing: 2rpx;margin-bottom: 16rpx;">
				联系电话：{{res.phone}}
			</view>
		<view style="font-size: 30rpx;letter-spacing: 2rpx;margin-bottom: 16rpx;">
			门店名称：{{res.title}}
		</view>
		<view style="font-size: 30rpx;letter-spacing: 2rpx;margin-bottom: 16rpx;">
			企业名称：{{res.attestation}}
		</view>
		<view style="font-size: 30rpx;letter-spacing: 2rpx;margin-bottom: 16rpx;">
			地址：{{res.address}}
		</view>
		<view class="" style="font-size: 30rpx;letter-spacing: 2rpx;margin-bottom: 16rpx;">
			简介：{{res.text}}
		</view>
		<!-- <view @click="dh" style="text-align: center;background-color: orange;color: white;width: 40%;margin:40rpx auto;height: 80rpx;line-height: 80rpx;border-radius: 20rpx;">
			导航
		</view> -->
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	import siteInfo from '@/siteinfo.js';
	export default {
		data() {
			return {
				id:'',
				res:'',
				isC: '../../static/images/c1.png',
				notC: '../../static/images/c2.png',
			}
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo,
			userInfo: state => state.user.userInfo,
			isGzhLogin: state => state.user.isGzhLogin,
		}),
		onLoad(e) {
			this.id = e.id
			this.getStoreDetail()
		},
		onShareAppMessage() {
			let {
				id: pid = 0
			} = this.userInfo
			let {
				id,
				name: title,
				cover: imageUrl
			} = this.res
			let path = `user/pages/storeDetail?id=${id}`
			return {
				title,
				imageUrl,
				path
			}
		},
		methods: {
				...mapActions(['getConfigInfo', 'getUserInfo']),
			dh(){
				// #ifdef H5
				window.location.href = "https://uri.amap.com/marker?position="+this.res.lng+","+this.res.lat+"&name="+this.res.title
				// #endif
			},
			async getStoreDetail(){
				// this.$api.technician.updateOrder({id:this.id})
				let res = await this.$api.shopstore.storeDetail({id:this.id})
				this.res = res
			},
			async coll() {
				var info = await this.$api.zxcadd.articleCollect({
					article_id: this.res.id,
					type: 4
				});
				this.$util.showToast({
					title: info,
				})
				if (this.res.is_collect == 1) {
					this.res.is_collect = 0
					return
				}
				if (this.res.is_collect == 0) {
					this.res.is_collect = 1
					return
				}
			},
		}
	}
</script>

<style>
.iconyduixingxingshixin {
			font-size: 28rpx;
			background-image: -webkit-linear-gradient(270deg, #FAD961 0%, #F76B1C 100%);
		}
		.icon {
			width: 54rpx;
			height: 54rpx;
		}
</style>
